# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=streamfinder
pkgver=1.2
pkgrel=2
pkgdesc='Searches for Alternate Data Streams (ADS).'
groups=('blackarch' 'blackarch-windows')
arch=('any')
makedepends=('unrar' 'curl')
url='https://www.gaijin.at/en/dlstreamfind.php'
source=("https://www.gaijin.at/downlo4d/$pkgname.rar")
DLAGENTS=("https::/usr/bin/curl -A 'Mozilla' -fLC - --retry 3 --retry-delay 3 -o %o %u")
noextract=("$pkgname.rar")
sha512sums=('262f0a13803973c41731c121ae8a25bb6ea3f003aa9b2ccd1ea8620274a4c178b33a4154a21c8880a5ff32322fa6d77f52ef1f25e5440ee0d353ad6b6beaecb9')

pkgver() {
  ver=$(curl -s -H 'User-Agent: Mozilla' https://www.gaijin.at/en/dlstreamfind.php |
  grep -P 'download_value' | grep -m1 -o -P '\d+\.\d+')

  echo "$ver"
}

package() {
  install -dm 755 "$pkgdir/usr/share/windows/$pkgname"

  unrar e "$pkgname.rar"

  rm -rf *.rar

  cp -a * "$pkgdir/usr/share/windows/$pkgname"
}

